﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using EzDesk.Apps.Model.ProjectModule;
using EzDesk.Utility.ServiceStatusInfo;

namespace EzDesk.Apps.Interface.ProjectModule
{
    [ServiceContract]
    public interface IProjectService
    {
        #region [ Workitem ]
        [OperationContract]
        StatusInfo<Guid> AddWorkitem(Workitem workItem);

        [OperationContract]
        StatusInfo<Guid> AddFinishedWorkitem(Workitem workitem);

        [OperationContract]
        StatusInfo UpdateWorkitem(Workitem newWorkitem, Guid actorId);
        
        [OperationContract]
        StatusInfo ConfirmWorkItem(Guid workitemId, Guid actorId);

        [OperationContract]
        StatusInfo FinishWorkitem(Guid workitemId, Guid actorId, int points);

        [OperationContract]
        StatusInfo PostponeWorkitem(Guid workitemId, DateTime newPlanOn);

        [OperationContract]
        StatusInfo<List<Workitem>> GetWorkitems(
            Guid? ownerId,  // 任务责任人
            Guid? creatorId,  // 任务创建人
            Guid? projectId,  // 所属项目
            Guid? taskId,
            WorkitemStatus? status, //任务状态
            bool? isFinished, // 任务是否完成            
            DateTime? startCreateOn, // 创建时间范围开始
            DateTime? endCreateOn, // 创建时间范围结束  
            DateTime? startFinishOn, // 完成时间范围开始
            DateTime? endFinishOn, // 完成时间范围结束
            int? maxCount // 最多条数
            );

        [OperationContract]
        StatusInfo<List<Workitem>> GetWorkitemByIds(List<Guid> guids);

        [OperationContract]
        StatusInfo<Workitem> GetWorkitem(Guid workitemId);



        [OperationContract]
        StatusInfo CheckTimeOutWorkItems();

        [OperationContract]
        StatusInfo SendDailyWorkBlog();

        [OperationContract]
        StatusInfo<List<WorkitemStatistics>> GetWorkitemStatistics(string memberstring, DateTime startDay,
                                                                   DateTime endDay);
        [OperationContract]
        void CheckStatisticsReport();
        
        #endregion Workitem

        #region [ DailyWork ]
        [OperationContract]
        StatusInfo<DailyWorks> GetDailyWork(Guid userId, DateTime day);
        [OperationContract]
        StatusInfo<List<DailyWorks>> GetDailyWorks(Guid userId, DateTime startDate, DateTime endDate);

        [OperationContract]
        StatusInfo<DailyWorks> UpdateDailyWorks(Guid userId, DateTime day, string content);
        #endregion

        #region [ Project Info ]

        [OperationContract]
        StatusInfo<Project> CreateNewProject(Project project);

        [OperationContract]
        StatusInfo UpdateProjectBasicInfo(Guid projectId,string projectName, string projectCode, string description);

        [OperationContract]
        StatusInfo UpdateProjectMember(Guid projectId, string memberString);

        [OperationContract]
        StatusInfo<List<Project>> GetProjects(Guid? userId, ProjectStatus[] projectStatus);

        [OperationContract]
        StatusInfo<List<Project>> GetProjectsForUser(Guid userId);

        [OperationContract]
        StatusInfo<Project> GetProjectById(Guid projectId);

        [OperationContract]
        StatusInfo<Project> GetFullProjectById(Guid projectId);

        [OperationContract]
        StatusInfo ChangeProjectStartOn(Guid projectId, DateTime newStartOn);

        [OperationContract]
        StatusInfo<ProjectTemplate> CreateProjectTemplate(ProjectTemplate projectTemplate);

        [OperationContract]
        StatusInfo<List<ProjectTemplate>> GetProjectTemplateList();

        [OperationContract]
        StatusInfo<Project> CreateNewProjectWithTemplate(Project project, Guid projectTemplateId, DateTime startOn);

        [OperationContract]
        StatusInfo RemoveProjectTemplate(Guid id);

        #endregion

        #region Task
        [OperationContract]
        StatusInfo<Task> CreateTask(Task task);
        [OperationContract]
        StatusInfo DeleteTask(Guid taskId);
        [OperationContract]
        StatusInfo UpdateTask(Task newTask);
        [OperationContract]
        StatusInfo<List<Workitem>> GetTaskWorkitems(Guid taskId);
        [OperationContract]
        StatusInfo<List<Task>> GetPorjectTasks(Guid projectId);
        [OperationContract]
        StatusInfo<List<Task>> GetPorjectsTasks(List<Guid> projectIdList);

        #endregion Task

        
    }
}
